﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Coronox.SkyShell
{
    public partial class LiveAccess
    {
          private string _scope = "wl.signin wl.offline_access";

          partial void GetClientId(ref string clientID); //implement a partial class to get the client id
          partial void GetClientSec(ref string clientSec); //implement a partial class to get the client secret

          internal Uri GetSignInUrl()
          {
              string ClientID = "";
              GetClientId(ref ClientID);
              return new Uri(String.Format(@"https://login.live.com/oauth20_authorize.srf?client_id={0}&redirect_uri=https://login.live.com/oauth20_desktop.srf&response_type=code&scope={1}", ClientID, _scope));

          }

          internal string GetAccessTokenUrl()
          {
              string ClientID = "";
              GetClientId(ref ClientID);
              string ClientSec = "";
              GetClientSec(ref ClientSec);
              return String.Format(@"https://login.live.com/oauth20_token.srf?client_id={0}&client_secret={1}&redirect_uri=https://login.live.com/oauth20_desktop.srf&grant_type=authorization_code&code=", ClientID, ClientSec);
          }

          internal string GetRefreshTokenUrl()
          {
              string ClientID = "";
              GetClientId(ref ClientID);
              string ClientSec = "";
              GetClientSec(ref ClientSec);
              return String.Format(@"https://login.live.com/oauth20_token.srf?client_id={0}&client_secret={1}&redirect_uri=https://login.live.com/oauth20_desktop.srf&grant_type=refresh_token&refresh_token=", ClientID, ClientSec);
          }
     
    }
}
